
package com.nextel.ui.custom; // Generated package name
import com.nextel.ui.*;
import com.nextel.util.lwuit.Font;
import javax.microedition.lcdui.Canvas;


public class OTextFieldDecimal
        extends OBoxtField implements OTextDecimalListener {

    public boolean isPermitirMasDecimal = false;

    public OTextFieldDecimal(int nbrOfChars, Font font) {
        super(nbrOfChars, font, OBoxtField.NUMERIC);

    }

    public OTextFieldDecimal(int nbrOfChars, Font font, int Constraint) {
        super(nbrOfChars, font, Constraint);
    }

    public void keyRepeated(int key) {
//        System.out.println("OTextFieldDecimal.keyRepeated" + key);
        if (key == Canvas.KEY_NUM1) {

            if (isPermitirMasDecimal) {
                keyPressed(Canvas.KEY_STAR);
                composer.document.insertChar('.');
                repaint();
            } else {
                if (composer.document.getText().indexOf('.') == -1) {
                    keyPressed(Canvas.KEY_STAR);
                    composer.document.insertChar('.');
                    repaint();
                }
            }
        }
    }
}

  
